package com.apex.controller;


import com.apex.pojo.Client;
import com.apex.pojo.Product;
import com.apex.service.ProductService;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author George
 * @since 2023-06-24
 */
@RestController
public class ProductController {

    @Resource
    private ProductService productService;
    @GetMapping(value = "/product-list")
    public ModelAndView clientQuery(Model model, ModelAndView modelAndView){
        List<Product> product = productService.productQuery();

        model.addAttribute("products",product);


        modelAndView.setViewName("BackEnd/product-list");
        return modelAndView;
    }

}

